#include "StateBox.h"

StateBox::StateBox(WINDOW * parent, int len_y, int len_x, int y, int x) : Widget(parent, len_y, len_x, y, x)
{
	m_box = true;
	m_connect_str = "timeout";
	m_can1_baudrate_str = "CAN1 : 0";
	m_can2_baudrate_str = "CAN2 : 0";
}

void StateBox::print(std::string str)
{
	mvwprintw(win, 1, 1, str.c_str());
	wrefresh(win);
}

int StateBox::fresh(void)
{
	mvwprintw(win, 1, 1, m_connect_str.c_str());
	mvwprintw(win, 2, 1, m_can1_baudrate_str.c_str());
	mvwprintw(win, 2, 40, m_can2_baudrate_str.c_str());

	if (m_display) {
		if (m_box) 
			box(win, 0, 0);

		return wrefresh(win);
	} else {
		return 0;
	}
} 
